﻿@model EnterpriseFund.Model.FinanceProp
@{
    Layout = null;
}
<!DOCTYPE html>
<html>
@Html.Partial("LoadPanelPartial")
<head>
    <title></title>
    @if (false)
    {
        <script src="../../Scripts/jquery-vsdoc.js" type="text/javascript"></script>
        <script src="../../Scripts/ASPxScriptIntelliSense.js" type="text/javascript"></script>
    }
    <link href="@Url.Content("~/Content/Site.css", true)" rel="stylesheet" type="text/css" />

    <script src="@Url.Content("~/Scripts/jquery.min.js", true)" type="text/javascript"></script>
    <script src="@Url.Content("~/Common/GetRootPath.ashx", true)" type="text/javascript"></script>

    @Html.DevExpress().GetStyleSheets(

        new StyleSheet { ExtensionType = ExtensionType.ListBox, Theme = DevExpressHelper.Theme }
)
    @Html.DevExpress().GetScripts(
        new Script { ExtensionType = ExtensionType.ListBox }
)


    <script type="text/javascript">
        function OK() {
        
            lpModal.Show();
            var codeNo = tbCodeNo.GetText();
            var codeName = tbCodeName.GetText();
            var ffinancePropShortName = tbFFinancePropShortName.GetText();

            if (pd(codeNo, codeName)) {
                codeNo = ASPxClientUtils.Trim(codeNo);
                codeName = ASPxClientUtils.Trim(codeName);
                ffinancePropShortName = ASPxClientUtils.Trim(ffinancePropShortName);
               
                    $.ajax({
                        type: 'POST',
                        url: rootPath + '/FinanceProp/FinancePropSave',
                        data: { financePropNo: codeNo, financePropName: codeName, fFinancePropShortName: ffinancePropShortName, isAdd: '@ViewData["blcodeNo"]' },
                        success: function (result) {
                            lpModal.Hide();
                            if (result == "exists") {
                                tbCodeNo.SetErrorText("编码已存在");
                                tbCodeNo.SetIsValid(false);
                            } else if (result == "ok") {
                                parent.codeOK();
                            } else if (result == "error") {
                                alert("保存失败");
                            }
                        }
                    });
   
            } else {
                lpModal.Hide();
            }
             
        }


        function pd(codeNo, codeName) {
            var bl = true;
            if (null == codeNo || ASPxClientUtils.Trim(codeNo) == "") {
                tbCodeNo.SetErrorText("请填写资金性质编码");
                tbCodeNo.SetIsValid(false);
                bl = false;
            }
            if (null == codeName || ASPxClientUtils.Trim(codeName) == "") {
                tbCodeName.SetErrorText("请填写资金性质名称");
                tbCodeName.SetIsValid(false);
                bl = false;
            }

            return bl;
        }

    </script>

</head>
<body>
    <table class="tableFrom">
        <tr>
            <th style=" width:150">
               资金性质编码:</th>
            <td>
                @Html.DevExpress().TextBox(settings =>
               {
                   settings.Name = "tbCodeNo";
                   settings.Width = 100;
                   if ((bool)@ViewData["blcodeNo"])
                   {
                       settings.ReadOnly = false;
                   }
                   else
                   {
                         settings.ReadOnly = true;
                   }
                   settings.Text = Model.FFinancePropNo;
                   settings.Properties.ValidationSettings.ErrorDisplayMode = ErrorDisplayMode.ImageWithText;
                   settings.Properties.ValidationSettings.EnableCustomValidation = true;
               }).GetHtml()
            </td>
        </tr>
        <tr>
            <th style=" width:150">
                资金性质名称:</th>
            <td>
                @Html.DevExpress().TextBox(settings =>
               {
                   settings.Name = "tbCodeName";
                   settings.Width = 150;
                   settings.Text = Model.FFinancePropName;
                   settings.Properties.ValidationSettings.ErrorDisplayMode = ErrorDisplayMode.ImageWithText;
                   settings.Properties.ValidationSettings.EnableCustomValidation = true;
               }).GetHtml()
            </td>
        </tr>
        <tr>
            <th style=" width:150">
              资金性质简称:</th>
            <td>
                @Html.DevExpress().TextBox(settings =>
               {
                   settings.Name = "tbFFinancePropShortName";
                   settings.Width = 150;
                   settings.Text = Model.FFinancePropShortName;
                   settings.Properties.ValidationSettings.ErrorDisplayMode = ErrorDisplayMode.ImageWithText;
                   settings.Properties.ValidationSettings.EnableCustomValidation = true;
               }).GetHtml()
            </td>
        </tr>
       @* <tr>
            <td colspan="2">
                @Html.DevExpress().Button(settings =>
              {
                  settings.Name = "btnOK";
                  settings.Text = "确定";
                  settings.ControlStyle.CssClass = "left";
                  settings.ClientSideEvents.Click = "OK";
              }).GetHtml()
                @Html.DevExpress().Button(settings =>
              {
                  settings.Name = "btnCancel";
                  settings.Text = "取消";
                  settings.CausesValidation = false;
                  settings.ControlStyle.CssClass = "left";
                  settings.ClientSideEvents.Click = "function(){parent.codeCancel();}";
              }).GetHtml()
            </td>
        </tr>*@
    </table>

    <script>
        lp.Hide();
    </script>

</body>
</html>
